#ifndef CHECKING_ACCOUNT_H
#define CHECKING_ACCOUNT_H

#include "BankAccount.h"
#include <string>

namespace MiniBanking
{

    /**
     * @brief Represents a Checking Account.
     *
     * Inherits from BankAccount and implements specific rules for checking accounts:
     * - Allows direct deposit and withdrawal.
     * - Can transfer to any other valid bank account.
     */
    class CheckingAccount : public BankAccount
    {
    public:
        /**
         * @brief Constructs a new CheckingAccount object.
         * @param accountID The unique ID for the account.
         * @param ownerName The name of the account holder.
         * @param initialBalance The starting balance (defaults to 0.0).
         */
        CheckingAccount(const std::string &accountID, const std::string &ownerName, double initialBalance = 0.0);

        // Override virtual functions from BankAccount
        virtual ~CheckingAccount() override = default; // Use override keyword

        /**
         * @brief Gets the account type ("Checking Account").
         * @return "Checking Account" string.
         */
        virtual std::string getAccountType() const override;

        /**
         * @brief Checks if a transfer to the destination account is allowed.
         * Checking accounts can transfer to any valid account.
         * @param destination The target account of the transfer (unused in logic here).
         * @return Always true for Checking Accounts.
         */
        virtual bool canTransferTo(const BankAccount &destination) const override;

        /**
         * @brief Attempts to deposit funds into this checking account.
         * @param amount The amount to deposit (must be positive).
         * @return True if deposit was successful, false otherwise (e.g., non-positive amount).
         */
        virtual bool deposit(double amount) override;

        /**
         * @brief Attempts to withdraw funds from this checking account.
         * @param amount The amount to withdraw (must be positive).
         * @return True if withdrawal was successful (sufficient funds), false otherwise.
         */
        virtual bool withdraw(double amount) override;

        // Note: No need to override initiateTransferOut if the base class logic
        // (just decreasing balance) is sufficient, and the rule check (canTransferTo)
        // is performed before calling it by the BankSystem.

        // Default copy/move constructors/assignments are fine
        CheckingAccount(const CheckingAccount &) = default;
        CheckingAccount &operator=(const CheckingAccount &) = default;
        CheckingAccount(CheckingAccount &&) = default;
        CheckingAccount &operator=(CheckingAccount &&) = default;
    };

}

#endif
